Skip to content

feat(parser): parse CALLED ON NULL INPUT as a property instead of Command#7792

Merged
geooo109 merged 6 commits into
tobymao:mainfrom
eruditmorina:parse-called-on-null-input
Jun 24, 2026
Merged

feat(parser): parse CALLED ON NULL INPUT as a property instead of Command#7792
geooo109 merged 6 commits into
tobymao:mainfrom
eruditmorina:parse-called-on-null-input

Conversation

@eruditmorina

Copy link
Copy Markdown
Contributor

Summary

Closes #4916

CREATE FUNCTION ... CALLED ON NULL INPUT falls back to exp.Command for every dialect, losing the AST representation. This PR aims to fix it by adding CalledOnNullInputProperty so the statement parses correctly as exp.Create.

The parser hook is added to the base parser rather than scoped to a single dialect (original issue reports Snowflake). This fixes Snowflake, Postgres, BigQuery, and the base sqlglot dialect. Added tests to cover Snowflake, Postgres and extended identity.sql to validate the default sqlglot dialect.

@geooo109 geooo109 self-assigned this Jun 24, 2026

@geooo109 geooo109 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! left some comments to take into account

Comment thread tests/dialects/test_snowflake.py Outdated
Comment thread sqlglot/parser.py Outdated
eruditmorina and others added 2 commits June 24, 2026 16:22
Co-authored-by: Giorgos Michas <geomichas96@gmail.com>
@eruditmorina eruditmorina requested a review from geooo109 June 24, 2026 14:42
Comment thread tests/dialects/test_snowflake.py
Co-authored-by: Giorgos Michas <geomichas96@gmail.com>

@geooo109 geooo109 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, thank you!

@geooo109 geooo109 merged commit 9f18b77 into tobymao:main Jun 24, 2026
8 checks passed
@eruditmorina eruditmorina deleted the parse-called-on-null-input branch June 24, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sqlglot parsing issue with Snowflake's CALLED ON NULL INPUT clause

2 participants